CC = g++
LD = g++
BIN = analyseDTD
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%.o)
DEPS = $(SRCS:%.cpp=%.d)
FLAGS = -Wall -ansi -pedantic


all: $(BIN)

$(BIN): *.l *.y $(OBJS) makefile
	flex -Pdtd dtd.l	
	bison -pdtd  --debug --verbose --defines=dtd.tab.h dtd.y
	g++ -g -DYYDEBUG=1 -o analyseDTD  lex.dtd.c $(OBJS) dtd.tab.c 

%.o:%.cpp
	$(CC) $(FLAGS) -o $@ -c $<

%.d: %.cpp
	$(CC) $(FLAGS) -MM -MD -o $@ $<


-include $(DEPS)


.PHONY: clean distclean

clean:
	-rm -rf *.o *.tab.c lex.*.c *.tab.h *.output analyseDTD

distclean: clean
	rm -rf $(BIN) $(DEPS)

